{% extends "openlavaweb/base.html" %}
{% load staticfiles %}
{% block content %}
<h1>Unit Tests</h1>
<link rel="stylesheet" href='{% static "openlavaweb/qunit/qunit.css" %}'>

<script src='{% static "openlavaweb/qunit/qunit.js" %}' ></script>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<script>

    QUnit.asyncTest( "HostListHasHosts", function( assert ) {
        expect(1);
        olwclient.serverUrl("{% url 'olw_system_view' %}");
        olwclient.Host.getHostList(function(hosts){
            assert.ok(hosts.length > 0, "Hostlist Length");
            QUnit.start();
        },function(){
            QUnit.start();
            throw "Error callback called";
        });
    });

    QUnit.asyncTest( "QueueListHasQueues", function( assert ) {
        expect(1);
        olwclient.serverUrl("{% url 'olw_system_view' %}");
        olwclient.Queue.getQueueList(function(queues){
            assert.ok(queues.length > 0, "Queuelist length");
            QUnit.start();
        },function(){
            QUnit.start();
            throw "Error callback called";
        });
    });

    QUnit.asyncTest( "UserListHasUsers", function( assert ) {
        expect(1);
        olwclient.serverUrl("{% url 'olw_system_view' %}");
        olwclient.User.getUserList(function(users){
            assert.ok(users.length > 0, "Userlist length");
            QUnit.start();
        },function(){
            QUnit.start();
            throw "Error callback called";
        });
    });

    QUnit.asyncTest( "JobListHasJobs", function( assert ) {
        expect(1);
        olwclient.serverUrl("{% url 'olw_system_view' %}");
        olwclient.Jobs.getJobList(function(jobs){
            assert.ok(jobs.length > 0, "JobList length");
            QUnit.start();
        },function(){
            QUnit.start();
            throw "Error callback called";
        });
    });

</script>

{% endblock %}

